"""
@Author: CheyenneLam
@Date: 2021-07-02 10:30:00
@LastEditTime: 2021-07-02 10:30:00
@LastEditors: CheyenneLam
@Description: 切分数据文件
@FilePath: \Main\main.py
"""

import datetime as dt
import xlwings as xw
from settings import *
import pandas as pd
import numpy as np
import win32com
import win32com.client
from win32com.client import constants as c
from process import *
import shutil

startTime = dt.datetime.now()
logger.debug(f"开始切分文件程序")

xlApp = win32com.client.Dispatch('Excel.Application')
xlApp.Visible=True
xlApp.DisplayAlerts = False

# 循环读入该路径下的文件
for sourceFileName in os.listdir(sourcePath):
    sourceFilePath = os.path.join(sourcePath, sourceFileName)
    resCsvFilePath = f"{sourceFileName.replace('.xlsx','')}"
    # 拆分文件
    targetFilePathList = copy_sheet(xlApp, sourceFilePath, resCsvFilePath)


xlApp.Quit()

endTime = dt.datetime.now()
print('用时:',endTime-startTime)
